package vip.geeker.iotms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vip.geeker.iotms.dto.WarnRuleDto;
import vip.geeker.iotms.persistance.mapper.WarnRuleMapper;
import vip.geeker.iotms.persistance.model.WarnRule;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class WarnRuleService extends ServiceImpl<WarnRuleMapper, WarnRule> {

    @Resource
    private WarnRuleMapper warnRuleMapper;


    public PageInfo<WarnRuleDto> queryPage(WarnRule rule) {
        PageHelper.startPage(rule.getPageNo(), rule.getPageSz());
        List<WarnRuleDto> list = warnRuleMapper.queryPage(rule);
        return new PageInfo<>(list);
    }

    public List<WarnRuleDto> queryList(WarnRule rule) {
        return  warnRuleMapper.queryPage(rule);
    }

}